Working with collections
Creating a collection
ctx := context.Background()
options := driver.CreateCollectionOptions{ /* ... */ }
col, err := db.CreateCollection(ctx, "myCollection", &options)
if err != nil {
// handle error
}
Check if a collection exists
ctx := context.Background()
found, err := db.CollectionExists(ctx, "myCollection")
if err != nil {
// handle error
}
Open a collection
ctx := context.Background()
col, err := db.Collection(ctx, "myCollection")
if err != nil {
// handle error
}
Help us improve
Anything unclear or buggy in this tutorial? Provide Feedback